# stage: install modules
FROM 907381039844.dkr.ecr.us-west-2.amazonaws.com/base/node:18 AS builder
ARG PROJECT_ENV=test
WORKDIR /web
COPY ./ ./
RUN npm config set registry https://registry.npmmirror.com && npm i
RUN npm run build:${PROJECT_ENV}


# stage: final
FROM 907381039844.dkr.ecr.us-west-2.amazonaws.com/base/nginx:latest AS final
WORKDIR /usr/share/nginx/html
COPY --from=builder /web/dist ./
COPY --from=build /app/realbox.com.$build_env.conf /etc/nginx/conf.d/realbox.com.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
